#ifndef ROCKET_NET_TCP_TCP_ACCEPTOR_H
#define ROCKET_NET_TCP_TCP_ACCEPTOR_H

#include <memory>

#include "net_addr.h"

namespace rocket {

class TcpAcceptor {

  public:
    typedef std::shared_ptr<TcpAcceptor> s_ptr;

    TcpAcceptor(NetAddr::s_ptr local_addr);

    ~TcpAcceptor();

    std::pair<int, NetAddr::s_ptr> accept();

    int getListenFd();

  private:
    // addr
    NetAddr::s_ptr m_local_addr;

    int m_family{-1};

    // listenfd
    int m_listenfd{-1};
};

} // namespace rocket

#endif
